<template>
  <div>
    <van-nav-bar
      :z-index="999"
      :fixed="true"
      left-arrow
      @click-left="onClickLeft"
      :placeholder="true"
      title="驾校图片"
    ></van-nav-bar>
    <div class="dp-list">
      <div class="dp-item" v-for="(item, index) in image" :key="index">
        <img :src="item" @click="imageURL(index)" />
      </div>
    </div>
  </div>
</template>

<script>
import { baseURL } from "../../assets/js/config";
import { ImagePreview } from "vant";
import { DetailePhotos } from "../../assets/js/api/apply";
export default {
  name: "DetailedPhotos",
  data() {
    return {
      images: [],
      image: []
    };
  },

  mounted() {
    this.baseURL = baseURL;
    DetailePhotos(this.$route.params.lid).then(res => {
      this.images = res.data;
      // console.log(this.images);
      for (let i = 0; i < this.images.length; i++) {
        this.image.push(this.images[i].fileurl);
      }
      // console.log(this.image);
    });
  },

  methods: {
    // 预览图片
    imageURL(index) {
      ImagePreview({
        images: this.image,
        startPosition: index
      });
    },
    onClickLeft() {
      this.$router.go(-1);
    }
  },
  created() {
    let dsBridge = require("dsbridge");
    dsBridge.call("goBack", "", function() {
      history.go(-1);
    });
  }
};
</script>

<style></style>
